<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>逾期报表</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">事业部</div>
                    <div class="field">
                        <input name="buOrgCd" id="buOrgCd" placeholder="请选择" ltype="combobox">
                    </div>
                </div>

                <div class="fieldBox">
                    <div class="label">逾期天数</div>
                    <div class="field">
                        <input ligerui="width: 82" name="ovdDaysMin" id="ovdDaysMin" type="text" class="ui-textbox"
                               value="" validate="{number:true}">
                        -
                        <input ligerui="width: 82" name="ovdDaysMax" id="ovdDaysMax" type="text" class="ui-textbox"
                               value="" validate="{number:true}">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">时间段</div>
                    <div class="field">
                        <input ligerui="width: 90" name="ovdDtMin" id="ovdDtMin" type="text" class="ui-datepicker"
                               value="" validate="{required:true}">
                        -
                        <input ligerui="width: 90" name="ovdDtMax" id="ovdDtMax" type="text" class="ui-datepicker"
                               value="" validate="{required:true}">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">任务人</div>
                    <div class="field">
                        <input name="collectUsrNm" id="collectUsrNm" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="formBtns notRight">
                    <span id="outBtn" class="sq-button sq-button-round">迁出率</span>
                    <span id="outRateBtn" class="sq-button sq-button-round">迁出明细</span>
                    <span id="inRateBtn" class="sq-button sq-button-round">迁入率</span>
                    <span id="clearBtn" class="sq-button sq-button-round">清空</span>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
                <div class="clearFix"></div>
            </div>
        </form>
        <input name="currentSiteNm" id="currentSite" type="hidden" class="ui-textbox" value="1"/>
    </div>
</div>

<div id="ligergrid1" class="sq-grid" style="display: block"></div>
<div id="ligergrid2" class="sq-grid" style="display: none"></div>
<div id="ligergrid3" class="sq-grid" style="display: none"></div>
</div>

<script type="text/javascript">
    var form = null,grid1= null,grid2= null,grid3= null;

    form = $("#searchBar").ligerForm({
        validate: true
    });

    grid1 = $("#ligergrid1").ligerGrid({
        url: '<%=path%>/risk/collectReport/taskAccepterOvdOutRate.do',
        method: 'get',
        columns: [
            {
                display: '迁出金额', name: 'penaltyAmount', minWidth: 100, align: 'center', enabledSort: false,
                render: function (rowdata, index, value) {
                    return '&yen;' + FormatMoney((rowdata.penaltyAmount) / 100);
                }
            },
            {
                display: '逾期金额合计', name: 'overdueAmount', minWidth: 100, align: 'center', enabledSort: false,
                render: function (rowdata, index, value) {
                    return '&yen;' + FormatMoney((rowdata.overdueAmount) / 100);
                }
            },
            {
                display: '迁出率', name: 'paymentRate', minWidth: 100, align: 'center', enabledSort: false,
            },
        ],
        usePager: false,
        root: 'rows',
        record: 'total',
        hideLoadButton: true,
        width: '100%',
        height: '100%',
        heightDiff: -2,
        allowUnSelectRow: true,
        alternatingRow: false,
        rownumbers: true,
        checkbox: false,
        delayLoad: true
    });

    grid2 = $("#ligergrid2").ligerGrid({
        url: '<%=path%>/risk/collectReport/taskAccepterOvdOutListReport.do',
        method: 'get',
        columns: [
            {
                display: '承租人', name: 'cstNm', minWidth: 100, align: 'center', enabledSort: false,
            },
            {
                display: '支付表号', name: 'paySchNo', minWidth: 100, align: 'center', enabledSort: false,
            },
            {
                display: '逾期日期',
                name: 'overdueDate',
                minWidth: 100,
                align: 'center',
                enabledSort: false,
                render: renderDate
            },
            {
                display: '逾期租金', name: 'overdueAmount', minWidth: 100, align: 'center', enabledSort: false,
                render: function (rowdata, index, value) {
                    return '&yen;' + FormatMoney(rowdata.overdueAmount / 100);
                }
            },
            {
                display: '罚息', name: 'penaltyAmount', minWidth: 100, align: 'center', enabledSort: false,
                render: function (rowdata, index, value) {
                    return '&yen;' + FormatMoney(rowdata.penaltyAmount / 100);
                }
            },
            {
                display: '已收取', name: 'payAmount', minWidth: 100, align: 'center', enabledSort: false,
                render: function (rowdata, index, value) {
                    return '&yen;' + FormatMoney(rowdata.payAmount / 100);
                }
            },
            {
                display: '逾期金额', name: '', minWidth: 100, align: 'center', enabledSort: false,
                render: function (rowdata, index, value) {
                    return '&yen;' + FormatMoney((rowdata.overdueAmount + rowdata.penaltyAmount) / 100);
                }
            },
        ],
        pageSize: 10,
        root: 'rows',
        record: 'total',
        hideLoadButton: true,
        width: '100%',
        height: '100%',
        heightDiff: -2,
        allowUnSelectRow: true,
        alternatingRow: false,
        rownumbers: true,
        checkbox: false,
        delayLoad: true
    });

    grid3 = $("#ligergrid3").ligerGrid({
        url: '<%=path%>/risk/collectReport/taskAccepterOvdDueInRate.do',
        method: 'get',
        columns: [
            {
                display: '迁入金额', name: 'penaltyAmount', minWidth: 100, align: 'center', enabledSort: false,
                render: function (rowdata, index, value) {
                    return '&yen;' + FormatMoney((rowdata.penaltyAmount) / 100);
                }
            },
            {
                display: '总金额', name: 'overdueAmount', minWidth: 100, align: 'center', enabledSort: false,
                render: function (rowdata, index, value) {
                    return '&yen;' + FormatMoney((rowdata.overdueAmount) / 100);
                }
            },
            {
                display: '迁入率', name: 'paymentRate', minWidth: 100, align: 'center', enabledSort: false,
            },
        ],
        usePager: false,
        root: 'rows',
        record: 'total',
        hideLoadButton: true,
        width: '100%',
        height: '100%',
        heightDiff: -2,
        allowUnSelectRow: true,
        alternatingRow: false,
        rownumbers: true,
        checkbox: false,
        delayLoad: true
    });

    //迁出率
    $("#outBtn").click(function (event) {
        if (!form.valid()) {
            top.$.ligerDialog.SQalert({content: "请选择查询时间段", SQ_type: "warning"});
            return false; //验证不通过，不执行以下代码
        }
        var data = form.getData();
        for (name in data) {
            grid1.setParm(name, data[name]);
        }
        if($("#currentSite").val()!="1"){
            $("#currentSite").val("1");
            $("#ligergrid1").css("display", 'block');
            $("#ligergrid2").css("display", 'none');
            $("#ligergrid3").css("display", 'none');
        }
        grid1.reload();
    });
    //迁出明细
    $("#outRateBtn").click(function (event) {
        if (!form.valid()) {
            top.$.ligerDialog.SQalert({content: "请选择查询时间段", SQ_type: "warning"});
            return false; //验证不通过，不执行以下代码
        }
        var data = form.getData();
        for (name in data) {
            grid2.setParm(name, data[name]);
        }
        if($("#currentSite").val()!="2"){
            $("#currentSite").val("2");
            $("#ligergrid1").css("display", 'none');
            $("#ligergrid2").css("display", 'block');
            $("#ligergrid3").css("display", 'none');
        }
        grid2.reload();
    });
    //迁入率
    $("#inRateBtn").click(function (event) {
        if (!form.valid()) {
            top.$.ligerDialog.SQalert({content: "请选择查询时间段", SQ_type: "warning"});
            return false; //验证不通过，不执行以下代码
        }
        var data = form.getData();
        for (name in data) {
            grid3.setParm(name, data[name]);
        }
        if($("#currentSite").val()!="3"){
            $("#currentSite").val("3");
            $("#ligergrid1").css("display", 'none');
            $("#ligergrid2").css("display", 'none');
            $("#ligergrid3").css("display", 'block');
        }
        grid3.reload();
    });

    $("#pageloading").hide();

    //事业部
    $("#buOrgCd").ligerComboBox({
        valueField: 'key',
        textField: 'value'
    });
    liger.get("buOrgCd").setData(${buOrgCdList});

    /* 清空 */
    $("#clearBtn").click(function (event) {
        clearLigerForm("searchBar");
    });
    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
        }
        return dateStr;
    }
</script>

</body>
</html>
